<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<!-- 视口标签 -->
<meta name="viewport"
	content="width=device-width, initial-scale=1, user-scalable=no" />
<!-- 删除苹果默认的工具栏和菜单栏 -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<!-- 设置苹果工具栏颜色 -->
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<!-- 忽略页面中的数字识别为电话，忽略email识别 -->
<meta name="format-detection" content="telphone=no, email=no" />
<!-- 启用360浏览器的极速模式(webkit) -->
<meta name="renderer" content="webkit">
<!-- 避免IE使用兼容模式 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- 针对手持设备优化，主要是针对一些老的不识别viewport的浏览器，比如黑莓 -->
<meta name="HandheldFriendly" content="true">
<!-- 微软的老式浏览器 -->
<meta name="MobileOptimized" content="320">
<!-- uc强制竖屏 -->
<meta name="screen-orientation" content="portrait">
<!-- QQ强制竖屏 -->
<meta name="x5-orientation" content="portrait">
<!-- UC应用模式 -->
<meta name="browsermode" content="application">
<!-- QQ应用模式 -->
<meta name="x5-page-mode" content="app">
<!-- windows phone 点击无高光 -->
<meta name="msapplication-tap-highlight" content="no">
<!-- 适应移动端end -->
<link rel="stylesheet" type="text/css"
	href="${path }/resource/css/base.css" />
<link rel="stylesheet" type="text/css"
	href="${path }/resource/css/index.css" />
<script type="text/javascript"
	src="${path }/resource/js/plugin/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/plugin/TouchSlide.1.1.js"></script>
<title>设计师作品</title>
<style type="text/css">
.add_works {
	height: 30px;
	border: 1px dashed #ccc;
	margin: 0 0 10px;
	line-height: 30px;
	display: flex;
	display: -webkit-box;
	display: -webkit-flex;
	display: -moz-box;
	display: -moz-flex;
	display: -ms-flexbox;
	display: flex;
	justify-content: center;
	padding: 0 .88rem;
}
</style>
</head>
<body>
	<div id="main_content" class="wrap">
		<section class="add_works">
			<span class="color_h">上传作品请登录：<a href="http://ashley.zkingsoft.com/designerIndex">ashley.zkingsoft.com/designerIndex</a></span>
		</section>
		<section class="white_bg" v-for="work in works"
			@click="toDetail(work.workId)">
			<div class="row pro_top">
				<div class="col">{{work.workTitle}}</div>
				<div class="col color_o txt_r">sj-{{work.workId}}</div>
			</div>
			<div class="pro_img">
				<img style="height: 200px" :src="getFirstImg(work.workImgs)"
					width="100%" alt="" />
			</div>
			<div class="pro_center">
				<div class="row">
					<img :src="work.desHeadimgurl" height="300" width="690"
						class="pro_gr" alt="" />
					<div class="col">
						<p>{{work.desName}}</p>
						<p>{{work.desRemark}}</p>
					</div>
				</div>
			</div>
			<div class="row pro_date">
				<p class="col">{{new
					Date(work.workCreateTime).toLocaleString()}}</p>
				<p class="col txt_r">
					<i class="look_icon"></i>{{work.workViewTimes}}
				</p>
			</div>
		</section>
	</div>
	<script type="text/javascript"
		src="${path }/resource/js/plugin/vue.min.js"></script>
	<script type="text/javascript">
		var workList = new Array();

		var main_content = new Vue({
			el : '#main_content',
			data : {
				works : workList
			},
			methods : {
				getFirstImg : function(imgs) {
					return imgs.split(";")[0];
				},
				toDetail : function(workId) {
					window.location.href = '${path}/app/works/toDetail?workId='
							+ workId;
				}
			}
		});

		$(function() {
			getWorkList();
			console.log(main_content.$data);
		})

		/**获取作品列表*/
		function getWorkList() {
			$.ajax({
				type : 'POST',
				url : '${path}/app/works/showList',
				data : {},
				dataType : 'json',
				async : false,
				success : function(res) {
					workList = res.rows;
					main_content.$data.works = res.rows;
				}
			})
		}
	</script>
</body>
</html>